<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
    <link href="${path}/assets/hplus/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	<link href="${path}/assets/publicSecurity/css/gonganQuery.css" rel="stylesheet">
	

</head>
<body>

	<!-- 顶部导航结束 -->
    <div class="wrapper wrapper-content  animated fadeInRight" >
        <div class="row" id="test01">
            <div >
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>已结算订单</h5>

                    </div>
                    <div class="ibox-content">
                        <form action="${path}/order/query" method="post" role="form" class="form-inline query-form">
                            <div class="form-group">
                                <label for="name" class="sr-only">编码</label>
                                <input type="text" placeholder="袋子编码" id="name" name="name" class="form-control">
                            </div>
                            <button type="button" id="btn-query" class="btn btn-primary">查询</button>
                        </form>

                        <div class="jqGrid_wrapper">
                            <table id="table_user"></table>
                            <div id="pager_user"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	

    <%@include file="/WEB-INF/common/hplus-js.jsp"%>

    <script type="text/javascript">
        $(document).ready(function () {
            $.jgrid.defaults.styleUI = 'Bootstrap';
            $("#table_user").jqGrid({
            	url : "${path}/orderclose/query",
                mtype : "POST",
                datatype : "JSON",
                jsonReader:{
                   	id: "id", //相当于设置主键
		           	root: "result",//Json数据
		           	total: "allPage",//总页数
					page: "page", //当前页
					records: "allCount",//总记录数
					repeatitems: false
                },
                altRows: true,//单双行样式不同
                altclass: 'differ',
                autowidth: true,
                shrinkToFit: true,
                height:353,
                rowNum: 10,
                rowList: [10, 20, 30],
                colNames: ['回收袋编号','结算时间', '总价(元)',  '总重(kg)','操作'],
                colModel: [{
                        name: 'sackId',
                        index: 'sackId',
                        width: 20
                    },{
                        name: 'createDate',
                        index: 'createDate',
                        width: 30
                    },{
                        name: 'total',
                        index: 'total',
                        width: 10

                    },{
                    name: 'gross',
                    index: 'gross',
                    width: 10

                    },{
                    name: 'operation',
                    index: 'operation',
                    width: 25,
                    formatter:function(cellvalue, options, rowObject){
                        var html = "<a class='btn btn-w-m btn-primary' style='font-size: 10px;margin: 3px;padding: 3px;' onclick=\"get('"+rowObject.id+"')\">查看</a>";
                        return html;
                    }
                }
                ],
                pager: "#pager_user",
                viewrecords: true,
                hidegrid: false,
                loadonce: true
            });
            $(window).bind('resize', function () {
                var width = $('.jqGrid_wrapper').width();
                $('#table_user').setGridWidth(width);
            });
            $(window).trigger("resize");


            $("#btn-query").click(function(){
            	$("#table_user").jqGrid('setGridParam', {
                    url : "${path}/orderclose/query",
                    datatype:'json',
                    postData : {
                    	"code":$("#name").val(),
                    },
                    page : 1
                }).trigger("reloadGrid"); //重新载入
            });
        });

        var wind;
         function get(id) {
            wind = layer.open({
                type: 2,
                title: '结算详情',
                shadeClose: false,
                shade: 0.5,
                area: ['100%', '100%'],
                content: '${path}/orderclose/det?id='+id //iframe的url
            });
        }

        function closeWind() {
            layer.close(wind);
        }


    </script>
</body>
</html>
